package com.ITD.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
/**
 * 网页返回结果类型
 */
public class Result {
    private boolean success;
    private int code;
    private String msg;
    private Object data;
    private String tips;

    /**
     *成功方法 只需要输入数据
     * @param data
     * @return
     */
    public static Result success(Object data){
        return new Result(true,200,"success",data,"成功");

    }

    /**
     *失败方法 需要附加数据
     * @param code
     * @param msg
     * @param tips
     * @return
     */
    public static Result fail(int code,String msg,String tips){

        return new Result(false,code,msg,null,tips);

    }
}
